From 73e9ee97b4c3ccc5ab202625f71e22806325c553 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 17 May 2006 23:41:59 +0100 Subject: [PATCH] Theoretically a 0 VIRT_BASE is okay. Change the bail code when parsing elf headers to bail only when VIRT_BASE is not specified at all. Signed-off-by: Keir Fraser --- tools/libxc/xc_load_elf.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/libxc/xc_load_elf.c b/tools/libxc/xc_load_elf.c index c09f819467..33b07bdb3f 100644 --- a/tools/libxc/xc_load_elf.c +++ b/tools/libxc/xc_load_elf.c @@ -148,16 +148,14 @@ static int parseelfimage(const char *image, dsi->xen_guest_string = guestinfo; - virt_base = 0; - if ( (p = strstr(guestinfo, "VIRT_BASE=")) != NULL ) - virt_base = strtoul(p+10, &p, 0); - - if ( virt_base == 0 ) + if ( (p = strstr(guestinfo, "VIRT_BASE=")) == NULL ) { - ERROR("Malformed ELF image. VIRT_BASE in '__xen_guest' section set incorrectly"); + ERROR("Malformed ELF image. No VIRT_BASE specified"); return -EINVAL; } + virt_base = strtoul(p+10, &p, 0); + dsi->elf_paddr_offset = virt_base; if ( (p = strstr(guestinfo, "ELF_PADDR_OFFSET=")) != NULL ) dsi->elf_paddr_offset = strtoul(p+17, &p, 0); -- 2.30.2